<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>管理登录 - Powered By ${systemConfig.systemName}</title>


<link rel="icon" href="favicon.ico" type="image/x-icon" />
<#include "/WEB-INF/template/common/include.ftl">
<link href="${base}/template/admin/css/login.css" rel="stylesheet" type="text/css" />

<link href="${base}/template/admin/management/themes/default/style.css" rel="stylesheet" type="text/css" />
<link href="${base}/template/admin/management/themes/css/core.css" rel="stylesheet" type="text/css" />
<link href="${base}/template/admin/management/themes/css/login.css" rel="stylesheet" type="text/css" />

<script type="text/javascript">

// 登录页面若在框架内，则跳出框架
if (self != top) {
	top.location = self.location;
};

$().ready( function() {

	var $username = $("#username");
	var $password = $("#password");
	var $captcha = $("#captcha");
	var $captchaImage = $("#captchaImage");
	var $isSaveUsername = $("#isSaveUsername");

	// 判断"记住用户名"功能是否默认选中,并自动填充登录用户名
	if($.cookie("adminUsername") != null) {
		$isSaveUsername.attr("checked", true);
		$username.val($.cookie("adminUsername"));
		$password.focus();
	} else {
		$isSaveUsername.attr("checked", false);
		$username.focus();
	}

	// 提交表单验证,记住登录用户名
	$("#loginForm").submit( function() {
		if ($username.val() == "") {
			$.message("请输入您的用户名!");
			$("#login_text").text("请输入您的用户名!");
			return false;
		}
		if ($password.val() == "") {
			$.message("请输入您的密码!");
			$("#login_text").text("请输入您的密码!");
			return false;
		}
		if ($captcha.val() == "") {
			$.message("请输入您的验证码!");
			$("#login_text").text("请输入您的验证码!");
			return false;
		}
		
		if($isSaveUsername.attr("checked") == true) {
			$.cookie("adminUsername", $username.val(), {expires: 30});
		} else {
			$.cookie("adminUsername", null);
		}
		
	});

	// 刷新验证码
	$captchaImage.click( function() {
		var timestamp = (new Date()).valueOf();
		var imageSrc = $captchaImage.attr("src");
		if(imageSrc.indexOf("?") >= 0) {
			imageSrc = imageSrc.substring(0, imageSrc.indexOf("?"));
		}
		imageSrc = imageSrc + "?timestamp=" + timestamp;
		$captchaImage.attr("src", imageSrc);
	});

	<#if (actionErrors?size > 0)>
		$.message("error", "<#list errorMessages as list>${list}<br></#list>");
	</#if>

});
</script>
</head>

<body>
	<div id="login">
		<div id="login_header">
			<h1 class="login_logo">
				<img src="${base}/template/admin/management/themes/default/images/logo.png" /> 
			</h1>

			<div class="login_headerContent">
				<div class="navList">
					<ul>
						<li><a href="/management/index!index.do">Home</a></li>
						<li><a href="http://weibo.com/dwzui" target="_blank">微博</a></li>
					</ul>
				</div>
				<h2 class="login_title">用户登录</h2>
			</div>
		</div>
		<div id="login_content">
			<div class="loginForm">
				<form id="loginForm" method="post" action="${base}/admin/loginVerify">
					<p>
						<label>用户名：</label>
						<input type="text" id="username" name="j_username" class="login_input" style="width: 140px;"/>
					</p>
					<p>
						<label>密&nbsp;&nbsp;&nbsp;码：</label>
						<input type="password" id="password" name="j_password" class="login_input" style="width: 140px;"/>
					</p>
					
					<p>
						<label>验证码：</label>
						<input class="code" id="captcha" name="j_captcha" size="5" />
						<span>
							<img src="themes/default/images/header_bg.png" alt="" width="75" height="24" />
							<div class="captchaImage">
	                   			<img id="captchaImage" src="${base}/captcha.jpg" alt="换一张" />
	                   		</div>
						</span>
					</p>
					
					<p>
						&nbsp;&nbsp;&nbsp;记住用户名<input type="checkbox" id="isSaveUsername" />
					</p>
					
					<div class="login_bar" style="padding-left: 81px;padding-top: 12px;">
						<input class="sub" type="submit" value=""/>
					</div>
				</form>
			</div>
			<div class="login_banner"><img src="${base}/template/admin/management/themes/default/images/login_banner.jpg" /></div>
			<div class="login_main">
				<ul class="helpList">
					<li><a id="login_text">请输入用户名和密码</a></li>
					<li id="forgotPwd" style="background: none; display: none">
					</li>
				</ul>

				<div class="login_inner">
					<!--  
					<p>Test User: admin</p>
					<p>Password: 123456</p>
					-->
				</div>
			</div>
		</div>
		<div id="login_footer">
			Copyright &copy; 2013 AJ Inc. All Rights Reserved.
		</div>
	</div>
</body>
</html>
